//package com.hcb.app911;
//
//import java.util.ArrayList;
//import java.util.List;
//
//import org.apache.http.NameValuePair;
//import org.apache.http.message.BasicNameValuePair;
//import org.json.JSONArray;
//import org.json.JSONException;
//import org.json.JSONObject;
//
//import com.hcb.adapter.AdapterResponderList;
//import com.hcb.adapter.AdapterYourContact;
//import com.hcb.common.ActionEvent;
//import com.hcb.constants.Constants;
//import com.hcb.dto.CustomerDTO;
//import com.hcb.dto.ResponderDTO;
//import com.hcb.dto.ResponderListDTO;
//import com.hcb.model.utils.CustomerModel;
//import com.hcb.webservice.InternetUtils;
//import com.hcb.webservice.ServiceHandler;
//
//import android.app.Activity;
//import android.content.Intent;
//import android.os.AsyncTask;
//import android.os.Bundle;
//import android.view.View;
//import android.view.View.OnClickListener;
//import android.widget.Button;
//import android.widget.ImageView;
//import android.widget.LinearLayout;
//import android.widget.ListView;
//import android.widget.TextView;
//import android.widget.Toast;
//
//public class AlertSentActivity extends Activity implements OnClickListener {
//	Button btnSentAlert;
//	ListView lvOurContact;
//	AdapterResponderList adapter;
//	ArrayList<Object> arrData;
//	ArrayList<Object> arrData1;
//	AdapterYourContact adapter1;
//	TextView txtYourName1, txtYourName2, txtStyle, strText;
//	String yourName1 = "", yourName2 = "";
//	String alert_id;
//	String strtextview = "If you have some time and are able to, kindly provide more information about your emergency and we will update the alerts";
//	ImageView imgyour1, imgyour2;
//
//	@Override
//	protected void onCreate(Bundle savedInstanceState) {
//		// TODO Auto-generated method stub
//		super.onCreate(savedInstanceState);
//		setContentView(R.layout.fragment_alert_sent);
//		btnSentAlert = (Button) findViewById(R.id.btnSentAlert);
//		lvOurContact = (ListView) findViewById(R.id.lvOurContact);
//		txtYourName1 = (TextView) findViewById(R.id.txtYourName1);
//		txtYourName2 = (TextView) findViewById(R.id.txtYourName2);
//		txtStyle = (TextView) findViewById(R.id.txtStyle);
//		strText = (TextView) findViewById(R.id.strText);
//		strText.setText(strtextview);
//		imgyour1 = (ImageView) findViewById(R.id.imgyour1);
//		imgyour2 = (ImageView) findViewById(R.id.imgyour2);
//
//		ResponderListDTO responderlist = (ResponderListDTO) getIntent()
//				.getSerializableExtra("data");
//		ArrayList<ResponderDTO> list = responderlist.getParliaments();
//
//		Bundle data = getIntent().getExtras();
//		String style = data.getString("style");
//		alert_id = data.getString("alert_id");
//		if (!style.equalsIgnoreCase("")) {
//			txtStyle.setText("<<" + style + ">>");
//		}
//		arrData = new ArrayList<Object>();
//		arrData1 = new ArrayList<Object>();
//		for (ResponderDTO responderDTO : list) {
//			arrData.add(responderDTO);
//
//		}
//		adapter = new AdapterResponderList(this,
//				R.layout.adapter_responder_list, arrData);
//		lvOurContact.setAdapter(adapter);
//		adapter.notifyDataSetChanged();
//
//		// adapter1 = new AdapterYourContact(this,
//		// R.layout.adapter_responder_list, arrData1);
//		// lvYourContact.setAdapter(adapter1);
//
//		CustomerModel model = CustomerModel.getInstance();
//		CustomerDTO dto = model.getCustomer(this);
//		new VerySlowTask(dto).execute();
//		btnSentAlert.setOnClickListener(this);
//
//	}
//
//	public class VerySlowTask extends AsyncTask<Void, Void, Void> {
//		String result;
//		CustomerDTO customer;
//
//		public VerySlowTask(CustomerDTO cus) {
//			customer = cus;
//		}
//
//		@Override
//		protected Void doInBackground(Void... params) {
//
//			ServiceHandler sh = new ServiceHandler();
//			List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
//			nameValuePairs.add(new BasicNameValuePair("query",
//					Constants.GET_CUSTOMER_DETAILS));
//			nameValuePairs.add(new BasicNameValuePair("api_secret_key",
//					Constants.API_KEY));
//			nameValuePairs.add(new BasicNameValuePair(Constants.CUSTOMER_ID,
//					customer.getCustomer_id()));
//			String jsonStr = sh.makeServiceCall(Constants.URL_SERVICE,
//					ServiceHandler.POST, nameValuePairs);
//			if (jsonStr != null) {
//				try {
//					JSONObject object;
//					object = new JSONObject(jsonStr);
//					String value = object.getString("result");
//					JSONObject data_body = object.getJSONObject("data_body");
//					if (value.contains("success")) {
//						CustomerDTO dto = new CustomerDTO();
//
//						String name1 = data_body
//								.getString("nominated_conact_name_one");
//						String name2 = data_body
//								.getString("nominated_conact_name_two");
//						if (!name1.equalsIgnoreCase("")) {
//							dto.setNominated_conact_name_one(name1);
//
//						}
//						if (!name2.equalsIgnoreCase("")) {
//							dto.setNominated_conact_name_two(name2);
//						}
//						yourName1 = dto.getNominated_conact_name_one();
//						yourName2 = dto.getNominated_conact_name_two();
//
//					}
//				} catch (JSONException e) {
//					e.printStackTrace();
//				}
//			} else {
//				// Log.e("ServiceHandler",
//				// "Couldn't get any data from the url");
//			}
//			return null;
//		}
//
//		@Override
//		protected void onPostExecute(Void result) {
//			// TODO Auto-generated method stub
//			super.onPostExecute(result);
//			txtYourName1.setText(yourName1);
//			txtYourName2.setText(yourName2);
//			if (!txtYourName1.getText().toString().equalsIgnoreCase("")) {
//				imgyour1.setBackgroundResource(R.drawable.iconcheck);
//			}
//			if (!txtYourName2.getText().toString().equalsIgnoreCase("")) {
//				imgyour2.setBackgroundResource(R.drawable.iconcheck);
//			}
//
//		}
//
//	}
//
//	@Override
//	protected void onResume() {
//		// TODO Auto-generated method stub
//		super.onResume();
//		btnSentAlert.setBackgroundResource(R.drawable.updatealert);
//	}
//	@Override
//	public void onClick(View v) {
//		int id = v.getId();
//		switch (id) {
//		case R.id.btnSentAlert:
//			if(InternetUtils.getInstance().isConnectingToInternet(AlertSentActivity.this)){
//				btnSentAlert.setBackgroundResource(R.drawable.updatealertf);
//				Intent intent = new Intent(this, UpdateAlertActivity.class);
//				intent.putExtra("alert_id", alert_id);
//				startActivity(intent);
//			}else{
//				Toast.makeText(AlertSentActivity.this, "No network please connect network", Toast.LENGTH_LONG).show();
//			}
//			
//			
//			break;
//
//		default:
//			break;
//		}
//
//	}
//}
